<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
*/

//$this->get($uri, 'App\Http\Controllers\\'.$controller.'@index');
//$this->get($uri.'/create', 'App\Http\Controllers\\'.$controller.'@create');
//$this->post($uri, 'App\Http\Controllers\\'.$controller.'@store');
//$this->get($uri.'/{id}', 'App\Http\Controllers\\'.$controller.'@show');
//$this->get($uri.'/{id}/edit', 'App\Http\Controllers\\'.$controller.'@edit');
//$this->put($uri.'/{id}', 'App\Http\Controllers\\'.$controller.'@update');
//$this->patch($uri.'/{id}', 'App\Http\Controllers\\'.$controller.'@update');
//$this->delete($uri.'/{id}', 'App\Http\Controllers\\'.$controller.'@destroy');

// V1 Public
$router->group(['prefix' => 'v1', 'middleware' =>'auth:api', 'namespace' => 'Api\V1'], function () use ($router) {

    // App
    $router->group(['prefix' => 'sites', 'middleware' =>'scope:user_client','namespace' => 'App'], function () use ($router) {
        $router->get('/', 'SiteController@index');
        $router->post('/', 'SiteController@store');
        $router->get('/{id}', 'SiteController@show');
        $router->put('/{id}', 'SiteController@update');
        $router->delete('/{id}', 'SiteController@destroy');
    });
});

// Site Module
$router->group([
    'prefix' => 'v1/site',
    'middleware' => [
        'auth:api',
        'app-auth:app_site',
        'app-authorize',
        'scopes:user_client,app_site'
    ],
    'namespace' => 'Api\V1\Site'],
    function () use ($router)
{

    // About
    $router->group(['prefix' => 'abouts'], function () use ($router) {
        $router->get('/', 'AboutController@index');
        $router->post('/', 'AboutController@store');
        $router->get('/{id}', 'AboutController@show');
        $router->put('/{id}', 'AboutController@update');
        $router->delete('/{id}', 'AboutController@destroy');
        $router->delete('/{id}/translations/{locale}', 'AboutController@deleteTranslations');
    });

    // Contact
    $router->group(['prefix' => 'contacts'], function () use ($router) {
        $router->get('/', 'ContactController@index');
        $router->post('/', 'ContactController@store');
        $router->get('/{id}', 'ContactController@show');
        $router->put('/{id}', 'ContactController@update');
        $router->delete('/{id}', 'ContactController@destroy');
        $router->delete('/{id}/translations/{locale}', 'ContactController@deleteTranslations');
    });

    // Email
    $router->group(['prefix' => 'emails'], function () use ($router) {
        $router->get('/', 'EmailController@index');
        $router->post('/', 'EmailController@store');
        $router->get('/{id}', 'EmailController@show');
        $router->put('/{id}', 'EmailController@update');
        $router->delete('/{id}', 'EmailController@destroy');
        $router->delete('/{id}/translations/{locale}', 'EmailController@deleteTranslations');
    });

    // Hotel
    $router->group(['prefix' => 'hotels'], function () use ($router) {
        $router->get('/', 'HotelController@index');
        $router->post('/', 'HotelController@store');
        $router->get('/{id}', 'HotelController@show');
        $router->put('/{id}', 'HotelController@update');
        $router->delete('/{id}', 'HotelController@destroy');
        $router->delete('/{id}/translations/{locale}', 'HotelController@deleteTranslations');
    });

    // HotelRoomType
    $router->group(['prefix' => 'hotel/{hotel_id}/room/types'], function () use ($router) {
        $router->get('/', 'HotelRoomTypeController@index');
        $router->post('/', 'HotelRoomTypeController@store');
        $router->get('/{id}', 'HotelRoomTypeController@show');
        $router->put('/{id}', 'HotelRoomTypeController@update');
        $router->delete('/{id}', 'HotelRoomTypeController@destroy');
        $router->delete('/{id}/translations/{locale}', 'HotelController@deleteTranslations');
    });

    // Important Dates
    $router->group(['prefix' => 'importants'], function () use ($router) {
        $router->get('/', 'ImportantController@index');
        $router->post('/', 'ImportantController@store');
        $router->get('/{id}', 'ImportantController@show');
        $router->put('/{id}', 'ImportantController@update');
        $router->delete('/{id}', 'ImportantController@destroy');
        $router->delete('/{id}/translations/{locale}', 'ImportantController@deleteTranslations');
    });

    // Introduction
    $router->group(['prefix' => 'introductions'], function () use ($router) {
        $router->get('/', 'IntroductionController@index');
        $router->post('/', 'IntroductionController@store');
        $router->get('/{id}', 'IntroductionController@show');
        $router->put('/{id}', 'IntroductionController@update');
        $router->delete('/{id}', 'IntroductionController@destroy');
        $router->delete('/{id}/translations/{locale}', 'AboutController@deleteTranslations');
    });

    // Mail
    $router->group(['prefix' => 'mails'], function () use ($router) {
        $router->get('/', 'MailController@index');
        $router->post('/', 'MailController@store');
//        $router->get('/{id}', 'MailController@show');
//        $router->put('/{id}', 'MailController@update');
//        $router->delete('/{id}', 'MailController@destroy');
    });

    // Member
    $router->group(['prefix' => 'members'], function () use ($router) {
        $router->get('/', 'MemberController@index');
//        $router->post('/', 'MemberController@store');
        $router->get('/{id}', 'MemberController@show');
//        $router->put('/{id}', 'MemberController@update');
        $router->delete('/{id}', 'MemberController@destroy');
    });

    // Menus
    $router->group(['prefix' => 'menus'], function () use ($router) {
        $router->get('/', 'MenuController@index');
        $router->get('/all/root', 'MenuController@root');
        $router->post('/', 'MenuController@store');
        $router->get('/{id}', 'MenuController@show');
        $router->put('/{id}', 'MenuController@update');
        $router->delete('/{id}', 'MenuController@destroy');
    });

    // NewsCategory
    $router->group(['prefix' => 'news/categories'], function () use ($router) {
        $router->get('/', 'NewsCategoryController@index');
        $router->post('/', 'NewsCategoryController@store');
        $router->get('/{id}', 'NewsCategoryController@show');
        $router->put('/{id}', 'NewsCategoryController@update');
        $router->delete('/{id}', 'NewsCategoryController@destroy');
    });

    // News
    $router->group(['prefix' => 'news'], function () use ($router) {
        $router->get('/', 'NewsController@index');
        $router->post('/', 'NewsController@store');
        $router->get('/{id}', 'NewsController@show');
        $router->put('/{id}', 'NewsController@update');
        $router->delete('/{id}', 'NewsController@destroy');
        $router->delete('/{id}/translations/{locale}', 'NewsController@deleteTranslations');
    });

    // Order
    $router->group(['prefix' => 'orders'], function () use ($router) {
        $router->get('/', 'OrderController@index');
        $router->post('/', 'OrderController@store');
        $router->get('/{id}', 'OrderController@show');
        $router->put('/{id}', 'OrderController@update');
        $router->delete('/{id}', 'OrderController@destroy');
    });

    // Organization
    $router->group(['prefix' => 'organizations'], function () use ($router) {
        $router->get('/', 'OrganizationController@index');
        $router->post('/', 'OrganizationController@store');
        $router->get('/{id}', 'OrganizationController@show');
        $router->put('/{id}', 'OrganizationController@update');
        $router->delete('/{id}', 'OrganizationController@destroy');
        $router->delete('/{id}/translations/{locale}', 'OrganizationController@deleteTranslations');
    });

    // Page
    $router->group(['prefix' => 'pages'], function () use ($router) {
        $router->get('/', 'PageController@index');
        $router->post('/', 'PageController@store');
        $router->get('/{id}', 'PageController@show');
        $router->put('/{id}', 'PageController@update');
        $router->delete('/{id}', 'PageController@destroy');
    });

    // PaperAbstract
    $router->group(['prefix' => 'paper/{paper_id}/abstracts'], function () use ($router) {
        $router->get('/', 'PaperAbstractController@index');
        $router->post('/', 'PaperAbstractController@store');
        $router->get('/{id}', 'PaperAbstractController@show');
        $router->put('/{id}', 'PaperAbstractController@update');
        $router->delete('/{id}', 'PaperAbstractController@destroy');
        $router->get('/{id}/review', 'PaperAbstractController@review');
        $router->get('/{id}/passed', 'PaperAbstractController@passed');
        $router->get('/{id}/refuse', 'PaperAbstractController@refuse');
        $router->get('/{id}/revise', 'PaperAbstractController@revise');
    });

    // PaperFull
    $router->group(['prefix' => 'paper/{paper_id}/fulls'], function () use ($router) {
        $router->get('/', 'PaperFullController@index');
        $router->post('/', 'PaperFullController@store');
        $router->get('/{id}', 'PaperFullController@show');
        $router->put('/{id}', 'PaperFullController@update');
        $router->delete('/{id}', 'PaperFullController@destroy');
        $router->get('/{id}/review', 'PaperFullController@review');
        $router->get('/{id}/passed', 'PaperFullController@passed');
        $router->get('/{id}/refuse', 'PaperFullController@refuse');
        $router->get('/{id}/revise', 'PaperFullController@revise');
    });

    // Paper
    $router->group(['prefix' => 'papers'], function () use ($router) {
        $router->get('/', 'PaperController@index');
        $router->post('/', 'PaperController@store');
        $router->get('/{id}', 'PaperController@show');
        $router->put('/{id}', 'PaperController@update');
        $router->delete('/{id}', 'PaperController@destroy');
    });

    // PaperTheme
    $router->group(['prefix' => 'paper/themes'], function () use ($router) {
        $router->get('/', 'PaperThemeController@index');
        $router->post('/', 'PaperThemeController@store');
        $router->get('/{id}', 'PaperThemeController@show');
        $router->put('/{id}', 'PaperThemeController@update');
        $router->delete('/{id}', 'PaperThemeController@destroy');
    });

    // Pay
    $router->group(['prefix' => 'pays'], function () use ($router) {
        $router->get('/', 'PayController@index');
        $router->post('/', 'PayController@store');
//        $router->get('/{id}', 'PayController@show');
//        $router->put('/{id}', 'PayController@update');
//        $router->delete('/{id}', 'PayController@destroy');
    });

    // Program
    $router->group(['prefix' => 'programs'], function () use ($router) {
        $router->get('/', 'ProgramController@index');
        $router->post('/', 'ProgramController@store');
        $router->get('/{id}', 'ProgramController@show');
        $router->put('/{id}', 'ProgramController@update');
        $router->delete('/{id}', 'ProgramController@destroy');
        $router->delete('/{id}/translations/{locale}', 'ProgramController@deleteTranslations');
    });

    // Promo
    $router->group(['prefix' => 'promos'], function () use ($router) {
        $router->get('/', 'PromoController@index');
        $router->post('/', 'PromoController@store');
        $router->get('/{id}', 'PromoController@show');
        $router->put('/{id}', 'PromoController@update');
        $router->delete('/{id}', 'PromoController@destroy');
        $router->delete('/{id}/translations/{locale}', 'PromoController@deleteTranslations');
    });

    // Registration
    $router->group(['prefix' => 'registrations'], function () use ($router) {
        $router->get('/', 'RegistrationController@index');
        $router->post('/', 'RegistrationController@store');
        $router->get('/{id}', 'RegistrationController@show');
        $router->put('/{id}', 'RegistrationController@update');
        $router->delete('/{id}', 'RegistrationController@destroy');
        $router->delete('/{id}/translations/{locale}', 'RegistrationController@deleteTranslations');
    });

    // Registration
    $router->group(['prefix' => 'registration/fees'], function () use ($router) {
        $router->get('/', 'RegistrationFeeController@index');
        $router->post('/', 'RegistrationFeeController@store');
        $router->get('/{id}', 'RegistrationFeeController@show');
        $router->put('/{id}', 'RegistrationFeeController@update');
        $router->delete('/{id}', 'RegistrationFeeController@destroy');
        $router->delete('/{id}/translations/{locale}', 'RegistrationController@deleteTranslations');
    });

    // Reporter
    $router->group(['prefix' => 'reporters'], function () use ($router) {
        $router->get('/', 'ReporterController@index');
        $router->post('/', 'ReporterController@store');
        $router->get('/{id}', 'ReporterController@show');
        $router->put('/{id}', 'ReporterController@update');
        $router->delete('/{id}', 'ReporterController@destroy');
        $router->delete('/{id}/translations/{locale}', 'ReporterController@deleteTranslations');
    });

    // Sponsors
    $router->group(['prefix' => 'sponsors'], function () use ($router) {
        $router->get('/', 'SponsorsController@index');
        $router->post('/', 'SponsorsController@store');
        $router->get('/{id}', 'SponsorsController@show');
        $router->put('/{id}', 'SponsorsController@update');
        $router->delete('/{id}', 'SponsorsController@destroy');
        $router->delete('/{id}/translations/{locale}', 'SponsorsController@deleteTranslations');
    });

    // Tourism
    $router->group(['prefix' => 'tourists'], function () use ($router) {
        $router->get('/', 'TourismController@index');
        $router->post('/', 'TourismController@store');
        $router->get('/{id}', 'TourismController@show');
        $router->put('/{id}', 'TourismController@update');
        $router->delete('/{id}', 'TourismController@destroy');
        $router->delete('/{id}/translations/{locale}', 'TourismController@deleteTranslations');
    });

    // Traffic
    $router->group(['prefix' => 'traffics'], function () use ($router) {
        $router->get('/', 'TrafficController@index');
        $router->post('/', 'TrafficController@store');
        $router->get('/{id}', 'TrafficController@show');
        $router->put('/{id}', 'TrafficController@update');
        $router->delete('/{id}', 'TrafficController@destroy');
        $router->delete('/{id}/translations/{locale}', 'TrafficController@deleteTranslations');
    });

    // Venue
    $router->group(['prefix' => 'venues'], function () use ($router) {
        $router->get('/', 'VenueController@index');
        $router->post('/', 'VenueController@store');
        $router->get('/{id}', 'VenueController@show');
        $router->put('/{id}', 'VenueController@update');
        $router->delete('/{id}', 'VenueController@destroy');
        $router->delete('/{id}/translations/{locale}', 'VenueController@deleteTranslations');
    });

    // Visa
    $router->group(['prefix' => 'visas'], function () use ($router) {
        $router->get('/', 'VisaController@index');
        $router->post('/', 'VisaController@store');
        $router->get('/{id}', 'VisaController@show');
        $router->put('/{id}', 'VisaController@update');
        $router->delete('/{id}', 'VisaController@destroy');
    });

    // Welcome
    $router->group(['prefix' => 'welcomes'], function () use ($router) {
        $router->get('/', 'WelcomeController@get');
        $router->post('/', 'WelcomeController@save');
    });
});